import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    userinfo: {}
  },
  getters: {
  },
  mutations: {
    saveUserInfo(state, userinfo) {
      if (userinfo) {

        state.userinfo = userinfo
        localStorage.setItem('userinfo', JSON.stringify(userinfo))
      }else{

        state.userinfo = JSON.parse(localStorage.getItem('userinfo'))
      }
    }
  },
  actions: {
  },
  modules: {
  }
})
